﻿@model IEnumerable<vngoodlife.Tag>

@{
    ViewBag.Title = "TagsList";
}


<div class="onecolumn">
    <div class="header">
        <span>Tạo và chỉnh sửa Tag</span>
    </div>
    <br class="clear" />
    <div class="content">
        @{Html.RenderPartial("/Views/BackEnd/Tags/_TagsMaker.cshtml", ViewBag.TagDetails as vngoodlife.Tag);}
    </div>
</div>


<!-- Begin one column tab content window -->
    <div class="onecolumn">
        <div class="header">
            <span>Danh Sách Tags</span>
            <div class="switchbutton">
                <a href="@Url.Action("TagsList_BackEnd", "Tags")" class="button">Thêm mới</a>
            </div>
        </div>
        <br class="clear" />
        <div class="content">
            <div id="tab1_content" class="tab_content">
                <table width="100%">
                    <tr>
                        <td>
                            <div id="tablewrapper">
                                <div id="tableheader">
                                    <div class="search">
                                        <select id="columns" onchange="sorter.search('query')">
                                        </select>
                                        <input type="text" id="query" onkeyup="sorter.search('query')" style="width:170px;" />
                                    </div>
                                    <div class="details">
                                        <div class="ddl">
                                            <div><label>Số lượng xuất hiện Tags mới:</label>
                                             @using (Html.BeginForm("TagsList_BackEnd", "Tags", FormMethod.Post))
                                             {
                                                @Html.DropDownList("amountOfTags", ViewBag.amountList as SelectList, "Tất cả", new { onchange = "this.form.submit();" })
                                             }
                                             </div>
                                        </div>
                                        <div>
                                            Kết quả
                                            <span id="startrecord"></span>-<span id="endrecord"></span>
                                            của
                                            <span id="totalrecords"></span>
                                        </div>
                                        <div><a href="javascript:sorter.reset()">Thiết lập lại</a></div>
                                    </div>
                                </div>
                                <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
                                    <thead>
                                        <tr>
                                           <th><h3>ID</h3></th>
                                           <th><h3>Tag</h3></th>
                                           <th><h3>Tag SeoUrl</h3></th>
                                           <th><h3>Lần chỉnh cuối</h3></th>
                                           <th><h3>Admin</h3></th>
                                            <th class="nosort"><h3>Edit</h3></th>
                                            <th class="nosort"><h3>Delete</h3></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach (var item in Model  ) { 
                                        <tr>
                                            <td style="width: 40px; text-align: center;">
                                                @item.TagsID
                                            </td>
                                            <td>
                                                @item.TagName
                                            </td>
                                            <td>
                                                @item.TagSeoUrl
                                            </td>
                                            <td style="width: 150px; text-align: center;">
                                                 @(vngoodlife.Util.GeneralClass.ConvertDate_1B(item.TagDate))
                                            </td>
                                            <td style="width: 110px; text-align: center;">
                                                @item.Member.FullName
                                            </td>
                                            <td style="width: 40px;text-align: center">
                                                <a href="@Url.Action("TagsList_BackEnd", "Tags", new { tagID = item.TagsID })"><span class="grid-edit"></span></a>
                                            </td>
                                            <td style="width: 40px;text-align: center">

                                                @using (Html.BeginForm("DeleteTag", "Tags", FormMethod.Post))
                                                {
                                                    @Html.AntiForgeryToken(vngoodlife.Util.AntiKey.EditSalt)
                                                    @Html.Hidden("tagID", item.TagsID)
                                                    @Html.Hidden("amountOfTags", (string)ViewBag.AmountOfTags )
                                                    <input type="submit" value="" class="SubmitDelete" onclick="javascript: if (confirm('Bạn muốn xóa Tag này?')) { window.location.href='#' } else { return false; };"/>
                                                }
                                            </td>
                                        </tr>
                                         } 
                                    </tbody>
                                </table>
                                <div id="tablefooter">
                                    <div id="tablenav">
                                        <div>
                                            <img alt="" src="../../../Content/table/images/first.gif" />
                                            <img src="../../../Content/table/images/first.gif" width="16" height="16" alt="First Page"
                                                onclick="sorter.move(-1,true)" />
                                            <img src="../../../Content/table/images/previous.gif" width="16" height="16" alt="First Page"
                                                onclick="sorter.move(-1)" />
                                            <img src="../../../Content/table/images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />
                                            <img src="../../../Content/table/images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />
                                        </div>
                                        <div>
                                            <select id="pagedropdown"></select>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.showall()">Xem tất cả</a>
                                        </div>
                                    </div>
                                    <div id="tablelocation">
                                        <div>
                                            <select onchange="sorter.size(this.value)">
                                                <option value="50" >50</option>
                                                <option value="200">200</option>
                                                <option value="500" selected="selected">500</option>
                                                <option value="800" >800</option>
                                                <option value="1000">1000</option>
                                            </select>
                                            <span>Kết quả mỗi trang</span>
                                        </div>
                                        <div class="page">
                                            Trang
                                            <span id="currentpage"></span>
                                            của
                                            <span id="totalpages"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <script type="text/javascript" src="../../../Content/table/2.js"></script>
                            <script type="text/javascript">
                                var sorter = new TINY.table.sorter('sorter', 'table', {
                                    headclass: 'head',
                                    ascclass: 'asc',
                                    descclass: 'desc',
                                    evenclass: 'evenrow',
                                    oddclass: 'oddrow',
                                    evenselclass: 'evenselected',
                                    oddselclass: 'oddselected',
                                    paginate: true,
                                    size: 500,               /*Number of rows show when running in first times */
                                    colddid: 'columns',
                                    currentid: 'currentpage',
                                    totalid: 'totalpages',
                                    startingrecid: 'startrecord',
                                    endingrecid: 'endrecord',
                                    totalrecid: 'totalrecords',
                                    hoverid: 'selectedrow',
                                    pageddid: 'pagedropdown',
                                    navid: 'tablenav',
                                    /*
                                    sortcolumn: 0,
                                    sortdir: 1,
                                    sum:[8],
                                    avg:[6,7,8,9],
                                    columns:[{index:7, format:'%', decimals:1},{index:8, format:'$', decimals:0}], */
                                    init: true
                                });
                            </script>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
<!-- End one column tab content window -->

